package com.woniuxy.sd.action;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class LoginAction extends  ActionSupport{
	private String name;
	private String mes;
	private String pass;
	
	public String getPass() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMes() {
		return mes;
	}

	public void setMes(String mes) {
		this.mes = mes;
	}

	public void validate(){
		if(name == null || name.trim().length() <= 0){
			this.addFieldError("nameerror", "<input type='text' value='用户名不能为空！' />");
		}else if(pass == null || pass.trim().length() <= 0){
			this.addFieldError("passerror", "<input type='text' value='密码不能为空！' />");
		}else if(name.equals("ghy") && !pass.equals("123")){
			this.addFieldError("nameerror", "<input type='text' value='密码错误！'/>");	
		}else if(name.equals("ghy") && pass.equals("123")){
			return;
		}else {
			this.addFieldError("nameerror", "<input type='text' value='用户名不存在！' />");
		}
	}
}
